package hoan.nguyen.domain;

// Generated May 24, 2013 9:52:44 PM by Hibernate Tools 4.0.0

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;

/**
 * Employee generated by hbm2java
 */
@Entity
@Table(name = "employee", catalog = "test_hibernate")
public class Employee implements java.io.Serializable {

	private Integer id;
	private String name;
	private Set<Address> addresses = new HashSet<Address>(0);
	private Set<Level> levels = new HashSet<Level>(0);

	public Employee() {
	}

	public Employee(String name) {
		this.name = name;
	}

	public Employee(String name, Set<Address> addresses, Set<Level> levels) {
		this.name = name;
		this.addresses = addresses;
		this.levels = levels;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", nullable = false, length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "employee", cascade = CascadeType.ALL )
	public Set<Address> getAddresses() {
		return this.addresses;
	}

	public void setAddresses(Set<Address> addresses) {
		this.addresses = addresses;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "employee_level", catalog = "test_hibernate", joinColumns = { @JoinColumn(name = "employee_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "level_id", nullable = false, updatable = false) })
	public Set<Level> getLevels() {
		return this.levels;
	}

	public void setLevels(Set<Level> levels) {
		this.levels = levels;
	}

}
